package com.bw.publish

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import com.blankj.utilcode.util.ToastUtils
import com.bw.lib_common.NavPath
import com.bw.lib_miv.BaseBox


@Composable
fun PublishPage(navHostController: NavHostController) {
    Column(
        Modifier
            .fillMaxWidth()
            .fillMaxHeight()
    ) {
        BaseBox(title = "发布")

        Row(
            Modifier
                .fillMaxWidth()
                .padding(end = 10.dp),
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.End
        ) {
            Image(
                painter = painterResource(id = R.drawable.ic_caogaoxiang),
                contentDescription = ""
            )

            Text(text = "草稿箱", color = Color(0xFFA8A8A8))
        }

        Text(
            text = "hi开启创作之旅吧",
            color = Color(0xFF767676),
            fontSize = 20.sp,
            modifier = Modifier.padding(start = 5.dp)
        )

        Row(
            Modifier
                .fillMaxWidth()
                .padding(start = 5.dp),
            verticalAlignment = Alignment.CenterVertically
        ) {
            Image(
                painter = painterResource(id = R.drawable.ic_moviesmall),
                contentDescription = ""
            )

            Text(text = "用视频分享生活", color = Color(0xFFA8A8A8))
        }

        Spacer(modifier = Modifier.height(20.dp))

        Row(
            Modifier
                .fillMaxWidth()
                .height(100.dp)
                .background(Color(0xFFA8A8A8)),
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.Center
        ) {
            Column(
                horizontalAlignment = Alignment.CenterHorizontally,
                modifier = Modifier.clickable {
                    ToastUtils.showLong("开拍")
                    navHostController.navigate(NavPath.PUBLISH_DETAIL)
                }) {
                Image(
                    painter = painterResource(id = R.drawable.ic_movie),
                    contentDescription = "",
                    contentScale = ContentScale.Crop, modifier = Modifier.size(60.dp)
                )

                Text(text = "现在开拍", color = Color.White)
            }
        }

        Spacer(modifier = Modifier.height(10.dp))

        Row(
            Modifier
                .fillMaxWidth()
                .height(50.dp)
                .background(Color.White)
                .padding(start = 10.dp), verticalAlignment = Alignment.CenterVertically
        ) {
            Image(painter = painterResource(id = R.drawable.ic_upload), contentDescription = "")
            Spacer(modifier = Modifier.width(10.dp))
            Text(text = "上传", color = Color(0xFFA8A8A8))
        }

        Spacer(modifier = Modifier.height(10.dp))

        Row(
            Modifier
                .fillMaxWidth()
                .height(60.dp)
                .background(Color.White),
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.Center
        ) {

            Column(
                Modifier
                    .weight(1f)
                    .fillMaxHeight(),
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Image(
                    painter = painterResource(id = R.drawable.ic_template),
                    contentDescription = ""
                )
                Text(text = "视频编辑", color = Color(0xFFA8A8A8))
            }

            Column(
                Modifier
                    .weight(1f)
                    .fillMaxHeight(),
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Image(
                    painter = painterResource(id = R.drawable.ic_material),
                    contentDescription = ""
                )
                Text(text = "免费素材", color = Color(0xFFA8A8A8))
            }

            Column(
                Modifier
                    .weight(1f)
                    .fillMaxHeight(),
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Image(
                    painter = painterResource(id = R.drawable.ic_toolbox),
                    contentDescription = ""
                )
                Text(text = "工具箱", color = Color(0xFFA8A8A8))
            }

            Column(
                Modifier
                    .weight(1f)
                    .fillMaxHeight(),
                verticalArrangement = Arrangement.Center,
                horizontalAlignment = Alignment.CenterHorizontally
            ) {
                Image(
                    painter = painterResource(id = R.drawable.ic_cut),
                    contentDescription = ""
                )
                Text(text = "视频剪辑", color = Color(0xFFA8A8A8))
            }
        }
    }
}